package gemini.castor.ui.client.page.content.store.pricelist;

import com.google.gwt.event.shared.GwtEvent;

public class PriceListEvent extends GwtEvent<PriceListHandler> {

	private static Type<PriceListHandler> TYPE;
	
	public static Type<PriceListHandler> getType() {
		if (TYPE == null)
			TYPE = new Type<PriceListHandler>();
		return TYPE;
	}
	
	public enum ForwardType {
		VIEW_PRODUCT;
	}
	
	public PriceListEvent(ForwardType forwardType) {
		super();
		this.setForwardType(forwardType);
	}
	
	private ForwardType forwardType;

	@Override
	protected void dispatch(PriceListHandler handler) {
		if(forwardType.equals(ForwardType.VIEW_PRODUCT)){
			handler.onViewProduct(this);
		}
	}
	
	@Override
	public Type<PriceListHandler> getAssociatedType() {
		return getType();
	}

	public void setForwardType(ForwardType forwardType) {
		this.forwardType = forwardType;
	}

	public ForwardType getForwardType() {
		return forwardType;
	}
}
